package com.wrench.elevator.tida.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.wrench.elevator.tida.constant.Result;
import com.wrench.elevator.tida.util.WrenchUtil;

@Controller
public class LogoutController
{
    @RequestMapping("/logout")
    public void logout(HttpServletRequest request, HttpServletResponse response, ModelMap map)
    {
        
        request.getSession().invalidate();
        map.put(Result.RESULT_CODE, Result.SUCCESS_CODE);
        map.put(Result.RESULT_MESSAGE, Result.SUCCESS_MESSAGE);
        map.put("message", "logout success");
        WrenchUtil.responseMap(response, map);
    }
}
